
<include file="Index/header" />
</head>
<script type="text/javascript">

	$(document).ready(function(){
	
		$.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}});
		$("#title").formValidator({onshow:"请输入标题",onfocus:"请输入标题"}).inputValidator({min:1,onerror:"请输入标题"})

	})

	
     $(function(){
			UE.getEditor('content');	
			var ue = UE.getEditor('content_desc', {
				toolbars:[
            ['fullscreen', 'source', '|', 'undo', 'redo', '|',
                'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
                'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
                'directionalityltr', 'directionalityrtl', 'indent', '|',
                'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
                'link', 'unlink',
                'insertimage']
        ],
				autoHeightEnabled: true,
				autoFloatEnabled: false
			});
	 })	 

</script>
<script type="text/javascript" src="__TMPL__Plugin/colorpicker/colorpicker.js"></script>
<body>
<script src="__TMPL__js/jquery-ui.min.js"></script>
<php>if($data['modelid']=='0'){</php>
<!--add-tab-->
<div class="add-tab" style="border:0;">
	<div class="at_tab">
		<a href="javascript:;" class="cur"><i>单页内容</i></a>
	</div><a href="javascript:location.reload();" style="float:right;" class="f5">刷新</a>
	<a href="javascript:window.history.go(-1);" style="float:right; margin-right:5px;" class="back">&lt;返回</a>
	<div class="clearall"></div>
</div>
<!--add-tab-->
<!--table-list-->
<div class="table-edit ">
	<form method="post" id="myform">

	<div class="table-edit_form">
		<div id="te_tab_1" class="te_tab_c">
			<table cellpadding="0" cellspacing="0" border="0" width="100%" class="table-edit_tb">
			<tbody>		
			<tr>
				<th width="200">栏目名称：</th>
				<td><{$data['classname']}> <a href="/index.php?g=admin&m=category&a=edit&id=<{$data['id']}>" class="f5" style=" margin-left:40px;" >分类设置</a></td>
			</tr>			
			<tr style="display:none;">
				<th>标题：</th>
				<td><input type="text" class="sys_text sys_text350" name="ctitle" id="ctitle" value="<{$data['ctitle']|escapeshow=###}>" /></td>
			</tr>			
			<tr>
				<th>缩略图：</th>
				<td><a style="padding:0;margin:0; float:left; margin-right:10px;" target="_blank" href="<{$data['cpicurl']}>" id="cpicurl_link"><img id="cpicurl_img" src="<{$data['cpicurl']}>" style="width:auto;height:auto; max-width:100px; max-height:80px;" /></a>
				<span style="float:left;"><input type="text" class="sys_text sys_text350"  style="margin-bottom:5px;" name="cpicurl" id="cpicurl" value="<{$data['cpicurl']}>"  /><br><input type="button" class="sys_btn" value="上传图片" onClick="getuploadify('uploadify','缩略图上传','image','image',1,'2mb','cpicurl')" /></span></td>
			</tr>
			<tr>
				<th>内容：</th>
				<td><textarea id="content" style="height:300px;width:85%;" name="content"><{$data['content']|escapeshow=###,true}></textarea>  </td>
			</tr>

			</tbody>
		</table>
		</div>
	
	</div>
	<div class="tools-edit">
		<table cellpadding="0" cellspacing="0" border="0" width="100%" class="tools-list_tb">
			<tr>
				<th width="200">&nbsp;</th>
				<td>
					<input type="submit" class="sys_blue_btn" value="提交" name="send" /> 
					<input type="hidden" value="<{$data['id']}>" name="id">
				</td>
			</tr>
		</table>
	</div>
	</form>
</div>
<!--/table-list-->
<php>}else{</php>
<!--add-tab-->
<div class="add-tab" style="border:0;">
	<a href="javascript:location.reload();" style="float:right;" class="f5">刷新</a>
	<a href="javascript:window.history.go(-1);" style="float:right; margin-right:5px;" class="back">&lt;返回</a>
	<div class="at_tab">
		<a href="<{:U('content/index',array('menuid'=>$data['id']))}>"><i><{$data['topclassname']}> - <{$data['classname']}> 信息管理</i></a> | 
		<a href="javascript:;" class="cur"><i><if condition="ACTION_NAME eq  'add'">添加内容<else/>编辑内容</if></i></a>

	</div>
	<div class="clearall"></div>
</div>
<!--add-tab-->
<!--table-list-->

<div class="table-edit">
	<form method="post" id="myform" action="<{:U('send')}>">
	<div class="table-edit_tab">
		<ul>
			<li data-id="te_tab_1" class="cur"><a href="javascript:;">常规信息</a></li>
			<li data-id="te_tab_2"><a href="javascript:;">其它信息</a></li>
			<li data-id="te_tab_3"><a href="javascript:;">相关信息</a></li>
		</ul>
		<div class="clearall"></div>
	</div>
	<div class="table-edit_form" style="padding-bottom:30px;">
		<div id="te_tab_1" class="te_tab_c">
			<table cellpadding="0" cellspacing="0" border="0" width="100%" class="table-edit_tb">
			<tbody>	
			<tr >
				<th  width="100">所属栏目</th>
				<td>
					<span id="category_text" style="font-weight:bold;"><{$data['classname']|escapeshow=###}></span> <input type="hidden" value="<{$data['id']}>" id="pid" name="info[pid]">
				<if condition="ACTION_NAME eq 'edit'">
				 <span style="padding:0 0 0 15px;color:#1307ff;cursor:pointer;" onClick="editCategory();">修改分类</span>				 </if>				</td>
			</tr>			

			<tr>
				<th>标题</th>
				<td>
					<input type="text" class="sys_text sys_text350 sys_input_title" name="info[title]" id="title" value="<{$info['title']|escapeshow=###}>" style="color:<{$info['style'][0]}>;font-weight:<{$info['style'][1]}>;" /><span class="maroon">*</span>
					<div class="title_panel">
						<input type="hidden" name="colorval" id="colorval" value="<{$info['style'][0]}>">
						<input type="hidden" name="boldval" id="boldval" value="<{$info['style'][1]}>" />
					<span title="标题颜色" class="color" onClick="colorpicker('colorpanel','colorval','title');"> </span> <span id="colorpanel"></span> <span title="标题加粗" class="blod" onClick="blodpicker('boldval','title');"> </span> <span title="清除属性" class="clear" onClick="clearpicker()">[#]</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;					</div>				</td>
			</tr>
			
			
			<tr>
				<th>缩略图</th>
				<td><a style="padding:0;margin:0; float:left; margin-right:10px;" target="_blank" href="<{$info['picurl']}>" id="picurl_link"><img id="picurl_img" src="<{$info['picurl']}>" style="width:auto;height:auto; max-width:100px; max-height:80px;" /></a>
				<span style="float:left;"><input type="text" class="sys_text sys_text350" style="margin-bottom:5px;" name="info[picurl]" id="picurl" value="<{$info['picurl']}>"  /><br>
<input type="button" class="sys_btn" value="上传图片" onClick="getuploadify('uploadify','缩略图上传','image','image',1,'2mb','picurl')" />	</span>
				</td>
			</tr>	
			<if condition="$data['toppid'] eq 55 ">	<!--新闻 -->
			<tr style="display:">
				<th>来源</th>
				<td>
					<input type="text" class="sys_text" name="info[source][text]" id="source" value="<{$info['source'][0]}>" />				</td>
			</tr>
			<tr >
				<th>链接地址</th>
				<td><input type="text" class="sys_text sys_text350" name="info[url]" id="url" value="<{$info['url']|escapeshow=###}>" /><span style="color:#999;padding:0 0 0 10px;">自定义链接地址时填写，默认链接请留空</span></td>
			</tr>
			</if>	
			<if condition="$data['toppid'] eq 999 ">
			<tr style=" display:;">
				<th>组图</th>
				<td>
				<style type="text/css">
	.ui-state-default { 
	border: 1px solid #d3d3d3; 
	background: #e6e6e6 url(ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; 
	font-weight: normal; color: #555555; outline: none;
	 }
	 #picarr_area .desc input{ display:none;}
	 #picarr_area .desc input:nth-child(2){ display:block;}
	</style>
	<script type="text/javascript">
	
	$(function() {
		$("#picarr_area").sortable();
		$("[name='info[picarr][]']").change(function(){
			var thisval=$(this).val();
			var a=$(this).parent().prev();
			a.attr("href",thisval);
			//$("#picurl_link").attr("href",thisval);
			a.find("img").attr("src",thisval).css("margin", "0px").height(90).width(120).picauto();
			//alert(a.find("img").attr("src"));
		});

	});
	</script>
				<fieldset class="picarr">
					<legend>列表</legend>
					<div>最多可以上传<strong>3张图片<span  class="f5"  onClick="getuploadify('uploadify2','组图上传','image','image',3,<{:C('cfg_max_file_size')}>,'picarr','picarr_area')">开始上传</span></div>
					<ul id="picarr_area">
						<if condition="trim($info['picarr'][0]) neq '' ">
						<volist name="info['picarr']" id="foo">	
						<li rel="<{$foo}>">
							<?php
								$a = explode("|", $foo);
								$url  =$a[0];
							?>	
							<a class="img" target="_blank" href="<{$url}>"><img src="<{$url}>"  name="picautozoom"/></a>
							<span class="desc"><input type="text" name="info[picarr_desc][]" placeholder="简介" value="<{$info['picarr_desc'][$i-1]}>">
							<input type="text" name="info[picarr][]" value="<{$foo}>">
							<a href="javascript:void(0);" onClick="ClearPicArr('<{$foo}>')">删除</a>
							</span></li>
						</volist>
						</if>
					</ul>
				</fieldset>				</td>
			</tr>
			</if>	
			<if condition="$data['toppid'] eq 52 or $data['toppid'] eq 202 "><!--首页 -->
			<tr >
				<th>链接地址</th>
				<td><input type="text" class="sys_text sys_text350" name="info[url]" id="url" value="<{$info['url']|escapeshow=###}>" /><span style="color:#999;padding:0 0 0 10px;">自定义链接地址时填写，默认链接请留空</span></td>
			</tr>
			<tr>
				<th>视频文件</th>
				<td>
						<input type="text" class="sys_text sys_text350" name="info[content_arr][video]" id="video" value="<{$info['content_arr']['video']}>"  />&nbsp;<input type="button" class="sys_btn" value="上传" onClick="getuploadify('uploadify','附件上传','media','media',1,'100mb','video')" />				</td>
			</tr>
			</if>
			<if condition="$data['toppid'] eq 56  or $data['toppid'] eq 203 "><!--关于 -->
			<tr>
				<th>放大图</th>
				<td><a style="padding:0;margin:0; float:left; margin-right:10px;" target="_blank" href="<{$info['cpicurl']}>" id="cpicurl_link"><img id="cpicurl_img" src="<{$info['cpicurl']}>" style="width:auto;height:auto; max-width:100px; max-height:80px;" /></a>
				<span style="float:left;"><input type="text" class="sys_text sys_text350"  style="margin-bottom:5px;" name="info[cpicurl]" id="cpicurl" value="<{$info['cpicurl']}>"  /><br><input type="button" class="sys_btn" value="上传图片" onClick="getuploadify('uploadify','缩略图上传','image','image',1,'2mb','cpicurl')" /></span></td>
			</tr>
			<tr>
				<th>视频文件</th>
				<td>
						<input type="text" class="sys_text sys_text350" name="info[content_arr][video]" id="video" value="<{$info['content_arr']['video']}>"  />&nbsp;<input type="button" class="sys_btn" value="上传" onClick="getuploadify('uploadify','附件上传','media','media',1,'100mb','video')" />				</td>
			</tr>
			</if>
			<if condition="$data['toppid'] eq 53  or $data['toppid'] eq 204"><!--产品 -->
			<tr>
				<th>放大图</th>
				<td><a style="padding:0;margin:0; float:left; margin-right:10px;" target="_blank" href="<{$info['cpicurl']}>" id="cpicurl_link"><img id="cpicurl_img" src="<{$info['cpicurl']}>" style="width:auto;height:auto; max-width:100px; max-height:80px;" /></a>
				<span style="float:left;"><input type="text" class="sys_text sys_text350"  style="margin-bottom:5px;" name="info[cpicurl]" id="cpicurl" value="<{$info['cpicurl']}>"  /><br><input type="button" class="sys_btn" value="上传图片" onClick="getuploadify('uploadify','缩略图上传','image','image',1,'2mb','cpicurl')" /></span></td>
			</tr>
			<tr style="display:">
				<th>型号</th>
				<td>
					<input type="text" class="sys_text" name="info[content_arr][model]" id="source" value="<{$info['content_arr']['model']}>" /></td>
			</tr>
			<tr style="display:">
				<th>识别号</th>
				<td>
					<input type="text" class="sys_text" name="info[content_arr][identify]" id="source" value="<{$info['content_arr']['identify']}>" />	</td>
			</tr>
			<tr>
				<th>简述</th>
				<td><textarea name="info[content_desc]" id="content_desc" style="width:85%;height:300px;"><{$info['content_desc']|escapeshow=###,true}></textarea></td>
			</tr>	
			</if>
			<if condition="$data['toppid'] eq 193  or $data['toppid'] eq 207"><!--客服 -->
			<tr>
				<th>附件</th>
				<td>
						<input type="text" class="sys_text sys_text350" name="info[content_arr][down]" id="video" value="<{$info['content_arr']['down']}>"  />&nbsp;<input type="button" class="sys_btn" value="上传" onClick="getuploadify('uploadify','附件上传','soft','soft',1,'2mb','video')" />				</td>
			</tr>
			</if>
			<if condition="$data['toppid'] eq 198 or $data['toppid'] eq 209 "><!--计量方案 -->
			<tr >
				<th>链接地址</th>
				<td><input type="text" class="sys_text sys_text350" name="info[url]" id="url" value="<{$info['url']|escapeshow=###}>" /><span style="color:#999;padding:0 0 0 10px;">自定义链接地址时填写，默认链接请留空</span></td>
			</tr>
			</if>
			<if condition="$data['toppid'] neq 198 and $data['toppid'] neq 209 ">
			<tr>
				<th>详细介绍</th>
				<td><textarea name="info[content]" id="content" style="width:85%;height:300px;"><{$info['content']|escapeshow=###,true}></textarea></td>
			</tr>	
			</if>
			<tr>
				<th>浏览次数</th>
				<td><input type="text" class="sys_text" name="info[hits]" id="hits" value="<{$info['hits']|intval=###}>" /></td>
			</tr>	
			
			<tr>
				<th>排序</th>
				<td><input type="text" class="sys_text" name="info[orderid]" id="orderid" value="<{$info['orderid']|intval=###}>" /></td>
			</tr>		
		
			<tr>
				<th>审核</th>
				<td>
					<label><input type="checkbox"   value="1" name="info[checkinfo]"  <if condition="$info['checkinfo']  eq '1' "> checked="checked" </if> /> 不通过 </label>				</td>
			</tr>
			</tbody>
		</table>
		</div>
		<div id="te_tab_2" class="te_tab_c" style="display:none;">
			<h2 class="title">其它信息</h2>
			<table cellpadding="0" cellspacing="0" border="0" width="100%" class="table-edit_tb">
			<tbody>
			
			
			<tr style="">
				<th>文章标签</th>
				<td><input type="text" class="sys_text " name="info[tag]" id="tag" value="<{$info['tag']|escapeshow=###}>" /><span style="color:#999;padding:0 0 0 10px;">用英文逗号或空格分开</span></td>
			</tr>
			<tr>
				<th>SEO关键字</th>
				<td><input type="text" class="sys_text " name="info[keywords]" id="keywords" value="<{$info['keywords']|escapeshow=###}>" />
				<span style="color:#999;padding:0 0 0 10px;">用英文逗号或空格分开</span>
				</td>
			</tr>			
			<tr style="">
				<th>简述</th>
				<td>
					<textarea class="sys_textarea sys_textarea350" name="info[description]" id="description" ><{$info['description']|escapeshow=###}></textarea>
					<span style="color:#999;padding:0 0 0 10px;"></span>
				</td>
			</tr>			

			<tr>
				<th width="100">属性</th>
				<td>
					<?php $FlagArr=C("contentflag");?>
                	<foreach name="FlagArr" item="v">
                	<label><input type="checkbox" name="info[flag][]" <if condition=' in_array($key,explode(",",$info["flag"])) '> checked="checked"</if> value="<{$key}>" /> <{$v}>[<{$key}>]</label>&nbsp;
                    </foreach>
				</td>
			</tr>
			
			</tbody>
		</table>
		</div>			
		
		<div id="te_tab_3" class="te_tab_c" style="display:none; ">
			<h2 class="title">相关信息</h2>
			<input type="hidden" id="relation_id" name="info[relation_id]" value="<{$info['relation_id']}>">
			<table cellpadding="0" cellspacing="0" border="0" width="100%" class="table-edit_tb">
			<tbody>
			<tr>
				<th width="100">所属栏目</th>
				<td>
					<select id="pid_ajax" name="pid_ajax">
						<option value="">请选择</option>
						<{:R('Content/category_node',array(0))}>
					</select>
				</td>
			</tr>			
			<tr>
				<th>相关内容</th>
				<td>
					<select id="option_list" size="2" multiple="multiple" style="width:600px;height:150px;">
						
					</select>
				</td>
			</tr>			
			<tr>
				<th valign="top">已选内容</th>
				<td id="relation_text">
					<ul>
						<volist name="relation" id="foo">
						<li><span><{$foo['id']}>-<{$foo['title']|escapeshow=###}></span><a href="javascript:;" data-id="<{$foo['id']}>"></a></li>
						</volist>
					</ul>
				</td>
			</tr>
			
			</tbody>
		</table>
		</div>	
	</div>
	<div class="tools-edit">
		<table cellpadding="0" cellspacing="0" border="0" width="100%" class="tools-list_tb">
			<tr>
				<th width="165">&nbsp;</th>
				<td>
					<input type="submit" class="sys_blue_btn" value="提交"  style="width:50%;" /> 
					<input type="hidden" value="<{$info['id']}>" name="info[id]">
			
				</td>
			</tr>
		</table>
	</div>
	</form>
</div>
<!--/table-list-->




<!--修改栏目弹窗-->
<div id="editCategoryDiv" style="display:none;">
    <table cellpadding="0" cellspacing="0" border="0" width="100%" class="table-edit_tb">
        <tbody>	
        <tr>
            <th width="80">修改栏目</th>
            <td>
            	<select id="edit_pid">
                    <option value="0">请选择</option>
                    <{:R('Content/edit_category_node',array(0,topclass($data['id'],'id'),'├',$data['id']))}>
                </select>
            </td>
        </tr>
        </tbody>
    </table>
</div>
<!--修改栏目弹窗-->

<php>}</php>


</body>
</html>

<script type="text/javascript">
//修改栏目弹窗
function editCategory(){
	$.dialog({
		content:document.getElementById("editCategoryDiv"),
		id:"pricingDialogDiv",
		padding:"10px",
		title:"修改栏目",
		background:"#fff",
		lock:true,
		fixed:true,
		ok:function(){
			var val=$("#edit_pid").val();
			if(val==0){alert("请选择栏目");return false;}
			
			$("#pid").val(val);
			$("#category_text").html('<font style="color:red;">已修改成：</font>'+$("#edit_pid option:selected").attr('text'));
		},
	})
}

$(function(){
	
	
	$("#pid_ajax").change(function(){
	
		$.get('<{:U('pulibc_relation_ajax')}>','id='+$(this).val(),function(data){
			
			$("#option_list").html(data);
			
		})
	})
	
	$("#option_list option").live('click',function(){
		
		$("#relation_id").val($("#relation_id").val()+','+$(this).val());
		$("#relation_text ul").append('<li><span>'+$(this).html()+'</span><a href="javascript:;" data-id="'+$(this).val()+'"></a></li>');
	})
	
	$("#relation_text ul li a").live('click',function(){
		$(this).parent("li").remove();
		var dataid='';
		$("#relation_text ul li").find("a").each(function(){
			dataid+=','+$(this).attr('data-id');
			
		})
	
		$("#relation_id").val(dataid);
		
	})
	
	$("#picurl").change(function(){
		var thisval=$(this).val();
		$("#picurl_link").attr("href",thisval);
		$("#picurl_img").attr("src",thisval);
	});
	$("#cpicurl").change(function(){
		var thisval=$(this).val();
		$("#cpicurl_link").attr("href",thisval);
		$("#cpicurl_img").attr("src",thisval);
	});
})



</script>

